﻿using System.IO;
using System.Net;

namespace cludg.Web.Core.Utils
{
	public static class RequestUtils
	{
		public static Stream Download(string url)
		{
			try
			{
				var request = WebRequest.Create(url);
				using (var response = request.GetResponse())
				{
					using (var responseStream = response.GetResponseStream())
					{
						var stream = new MemoryStream();
						responseStream.CopyTo(stream);
						return stream;
					}
				}
			}
			catch
			{
				return null;
			}
		}
	}
}
